/*Man H. Vu
 *CS 362 SE II
 *Testing isGameOver()
 */

#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <stdio.h>
#include <stdlib.h>

int main(){
	struct gameState *currGame = (struct gameState *)malloc(sizeof(struct gameState));
	int cards[9] = {tribute, gardens, embargo, sea_hag, village, mine, minion, cutpurse, adventurer};
	int i;
	initializeGame(4, cards, 3121, currGame);
	currGame->supplyCount[province] = 3;
	if (isGameOver(currGame) == 0){
		printf("Testing province = 3. Expected: 0 game not over, Result: %d --- PASS\n",isGameOver(currGame));
	}else{
		printf("Testing province = 3. Expected: 0 game not over, Result: %d --- FAIL\n",isGameOver(currGame));
	}
	currGame->supplyCount[province] = 0;
	if (isGameOver(currGame) == 1){
		printf("Testing province = 0. Expected: 1 game not over, Result: %d --- PASS\n",isGameOver(currGame));
	}else{
		printf("Testing province = 0. Expected: 1 game not over, Result: %d --- FAIL\n",isGameOver(currGame));
	}
	// testing other supply for >3 == 0
	currGame->supplyCount[province] = 3;
	for (i = 0; i<25; i++){
		currGame->supplyCount[i] = 1;
	}

	currGame->supplyCount[2] = 0;
	currGame->supplyCount[24] = 0;
	if (isGameOver(currGame) == 0){
		printf("Testing empty supply = 2. Expected: 0 game not over, Result: %d --- PASS\n",isGameOver(currGame));
	}else{
		printf("Testing empty supply = 2. Expected: 0 game not over, Result: %d --- FAIL\n",isGameOver(currGame));
	}

	currGame->supplyCount[20] = 0;
	if (isGameOver(currGame) == 1){
		printf("Testing empty supply = 3. Expected: 1 game not over, Result: %d --- PASS\n",isGameOver(currGame));
	}else{
		printf("Testing empty supply = 3. Expected: 1 game not over, Result: %d --- FAIL\n",isGameOver(currGame));
	}

	currGame->supplyCount[21] = 0;
	if (isGameOver(currGame) == 1){
		printf("Testing empty supply = 4. Expected: 1 game not over, Result: %d --- PASS\n",isGameOver(currGame));
	}else{
		printf("Testing empty supply = 4. Expected: 1 game not over, Result: %d --- FAIL\n",isGameOver(currGame));
	}
	return 0;
}
